//
//  MainVC.m
//  LearnAnimals
//
//  Created by Admin on 1/8/13.
//  Copyright (c) 2013 THACHTUYET. All rights reserved.
//

#import "MainVC.h"
#import "PracticeVC.h"
#import "SettingVC.h"
#import "AboutVC.h"
#import "HighScoreVC.h"


@interface MainVC ()

@end

@implementation MainVC

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationController.hidesBottomBarWhenPushed = YES;
    _aboutView.alpha = 0;
    NSString *filePath=[[NSBundle mainBundle]pathForResource:@"about" ofType:@"html" inDirectory:nil];
    NSString *htmlstring=[NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
    [_webview loadHTMLString:htmlstring baseURL:nil];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewWillAppear:(BOOL)animated
{
    [self.navigationController.navigationBar setHidden:YES];
}


- (IBAction)goSetting:(id)sender
{
    SettingVC *settingView = [[SettingVC alloc] initWithNibName:@"SettingVC" bundle:nil];
//    [UIView beginAnimations:nil context:nil];
//    [UIView setAnimationDuration:0.8];
//    [self.navigationController pushViewController:settingView animated:YES];
//    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];
//    [UIView commitAnimations];

    [settingView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
    [self presentViewController:settingView animated:YES completion:nil];

}
- (IBAction)goAbout:(id)sender
{
    [UIView animateWithDuration:0.5 animations:^{
        _aboutView.alpha = 1;
    }];
}
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [UIView animateWithDuration:0.5 animations:^{
         _aboutView.alpha = 0;
    }];
}
- (IBAction)goPractice:(id)sender
{
    PracticeVC *practiceView = [[PracticeVC alloc] initWithNibName:@"PracticeVC" bundle:nil];
    [UIView beginAnimations:@"push" context:nil];
    [UIView setAnimationDuration:0.8];
    [self.navigationController pushViewController:practiceView animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];
}
- (IBAction)goTesting:(id)sender
{
    PracticeVC *testingView = [[PracticeVC alloc] initWithNibName:@"PracticeVC" bundle:nil];
    [UIView beginAnimations:@"push" context:nil];
    [UIView setAnimationDuration:0.8];
    [self.navigationController pushViewController:testingView animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];
}
- (IBAction)goHighScore:(id)sender
{
    HighScoreVC *highScoreView = [[HighScoreVC alloc] initWithNibName:@"HighScoreVC" bundle:nil];
    [UIView beginAnimations:@"push" context:nil];
    [UIView setAnimationDuration:0.8];
    [self.navigationController pushViewController:highScoreView animated:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.navigationController.view cache:NO];
    [UIView commitAnimations];
}
@end
